import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import VueSetupExtend from 'vite-plugin-vue-setup-extend';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';

import path from "path";

export default defineConfig({
	base: './',
	resolve: {
		alias: {
			'@': path.resolve(__dirname, "src"),
		}
	},
	plugins: [
		vue(),
		VueSetupExtend(),
		AutoImport({
			resolvers: [ElementPlusResolver()]
		}),
		Components({
			resolvers: [ElementPlusResolver()]
		})
	],
	css: {
		preprocessorOptions: {
			less: {
				modifyVars: {
					hack: `true; @import (reference) "${path.resolve("src/assets/cs/base.less")}";`,
				},
				javascriptEnabled: true,
			},
		},
	},
	optimizeDeps: {
		include: ['schart.js']
	},
	build: {
		outDir: '../fe'
	}
});
